﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminPanel/AdminSite.Master" AutoEventWireup="true" CodeBehind="OperatorRegistrationForm.aspx.cs" Inherits="FastTrackCabService.AdminPanel.OperatorRegistrationForm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Scripts/jquery.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.maskedinput.min.js" type="text/javascript"></script>
    <script src="../Scripts/masked_telephone.js" type="text/javascript"></script>
    <link href="../Style/Form.css" rel="stylesheet" type="text/css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table id="form">
        <tr>
            <th colspan="3">
                Operator registration
            </th>
        </tr>
        <tr>
            <td>
                Username
            </td>
            <td>
                <asp:UpdatePanel ID="upUsernameTB" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="tbUsername" runat="server" MaxLength="15" AutoPostBack="True" OnTextChanged="tbUsername_OnTextChanged"></asp:TextBox>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvUsername" ControlToValidate="tbUsername" runat="server"
                                            Text="*" Display="Dynamic" ErrorMessage="Username is required" ForeColor="Red"
                                            ValidationGroup="Registration">
                </asp:RequiredFieldValidator>
                <asp:UpdatePanel ID="upUsernameValidation" runat="server">
                    <ContentTemplate>
                        <asp:CustomValidator ID="cvUsername" runat="server" Display="Dynamic" ValidationGroup="Registration"
                                             ErrorMessage="Username already exist try a different username" Text="*" ForeColor="Red"
                                             OnServerValidate="cvUsername_OnServerValidate">
                        </asp:CustomValidator>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:RegularExpressionValidator ID="revUsername" Display="Dynamic" ValidationGroup="Registration"
                                                runat="server" Text="*" ForeColor="Red" ControlToValidate="tbUsername" ErrorMessage="Username should be atleast minimum of 4 characters<br/> and the characters should be only alphabets and numbers"
                                                ValidationExpression="[a-zA-Z0-9]{4,}">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Password
            </td>
            <td>
                <asp:TextBox ID="tbPassword" runat="server" MaxLength="20" TextMode="Password"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="tbPassword"
                                            Display="Dynamic" ErrorMessage="Password is required" Text="*" ForeColor="Red"
                                            ValidationGroup="Registration">
                </asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Confirm Password
            </td>
            <td>
                <asp:TextBox ID="tbPassword2" runat="server" MaxLength="20" TextMode="Password"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvPassword2" runat="server" ControlToValidate="tbPassword2"
                                            Display="Dynamic" ErrorMessage="Confirm the password" Text="*" ForeColor="Red"
                                            ValidationGroup="Registration">
                </asp:RequiredFieldValidator>
                <asp:CompareValidator ID="cvPassword" runat="server" ControlToCompare="tbPassword"
                                      ControlToValidate="tbPassword2" Display="Dynamic" ErrorMessage="Password mismatch"
                                      ForeColor="Red" ValidationGroup="Registration" Text="*">
                </asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td>
                First name
            </td>
            <td>
                <asp:TextBox ID="tbFName" MaxLength="20" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvFName" runat="server" ControlToValidate="tbFName"
                                            Display="Dynamic" ErrorMessage="First name is required" ForeColor="Red" Text="*"
                                            ValidationGroup="Registration">
                </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="revFName" ForeColor="Red" Text="*" ControlToValidate="tbFName"
                                                ValidationGroup="Registration" runat="server" ErrorMessage="Enter a valid first name"
                                                Display="Dynamic" ValidationExpression="[a-zA-Z ]{3,}">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Last name
            </td>
            <td>
                <asp:TextBox ID="tbLName" runat="server" MaxLength="20"></asp:TextBox>
            </td>
            <td>
                <asp:RegularExpressionValidator ID="revLName" ForeColor="Red" Text="*" ControlToValidate="tbLName"
                                                ValidationGroup="Registration" runat="server" ErrorMessage="Enter a valid last name"
                                                Display="Dynamic" ValidationExpression="[a-zA-Z ]{3,}">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                E-Mail
            </td>
            <td>
                <asp:UpdatePanel ID="upEMailTB" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="tbEMail" runat="server" MaxLength="50" OnTextChanged="tbEMail_OnTextChanged" AutoPostBack="True"></asp:TextBox>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvEMail" runat="server" ControlToValidate="tbEMail"
                                            Display="Dynamic" ErrorMessage="E-Mail is required" ForeColor="Red" Text="*"
                                            ValidationGroup="Registration">
                </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="revEMail" runat="server" ControlToValidate="tbEMail"
                                                Display="Dynamic" ErrorMessage="Please enter a valid E-Mail" ForeColor="Red"
                                                Text="*" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                ValidationGroup="Registration">
                </asp:RegularExpressionValidator>
                <asp:UpdatePanel ID="upEMailValidation" runat="server">
                    <ContentTemplate>
                        <asp:CustomValidator ID="cvEMail" Text="*" ForeColor="Red" runat="server" ErrorMessage="This e-mail address is already beign used"
                                             Display="Dynamic" ValidationGroup="Registration" OnServerValidate="cvEMail_OnServerValidate">
                        </asp:CustomValidator>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>
                Telephone number
            </td>
            <td>
                <asp:TextBox ID="tbTelephone" runat="server" MaxLength="11"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvTelephone" runat="server" ControlToValidate="tbTelephone"
                                            Display="Dynamic" ErrorMessage="Telephone number is required" ForeColor="Red" Text="*"
                                            ValidationGroup="Registration">
                </asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Address
            </td>
            <td>
                <asp:TextBox ID="tbAddress" Rows="4" MaxLength="100" TextMode="MultiLine" runat="server"></asp:TextBox>
            </td>
            <td>

            </td>
        </tr>
        <tr>
            <td colspan="3" style="text-align: center;">
                <asp:Button ID="btnRegister" CssClass="submit" runat="server" Text="Register" ValidationGroup="Registration"
                            OnClick="btnRegister_OnClick"/>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:UpdatePanel ID="upValidationSummary" runat="server">
                    <ContentTemplate>
                        <asp:ValidationSummary ID="ValidationSummary1" CssClass="validationSummary"
                                               runat="server" ForeColor="Red" HeaderText="&lt;b&gt;Please fix following error(s):&lt;/b&gt;"
                                               ValidationGroup="Registration"/>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>